package com.fowo.api.syncLingxingApi.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fowo.api.entity.Product;
import com.fowo.api.syncLingxingApi.entity.TmpSyncLingxingToProduct;
import com.fowo.api.syncLingxingApi.mapper.TmpSyncLingxingToProductMapper;
import com.fowo.api.syncLingxingApi.service.TmpSyncLingxingToProductService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
@Slf4j
@DS("ds24")
public class TmpSyncLingxingToProductServiceImpl
        extends ServiceImpl<TmpSyncLingxingToProductMapper, TmpSyncLingxingToProduct>
        implements TmpSyncLingxingToProductService {

    @Override
    public Integer insertIntoProducts(String version) {
        return baseMapper.insertToProducts(version);
    }
    @Override
    public Integer updateToProducts(String version) {
        return baseMapper.updateToProducts(version);
    }
    @Override
    public void deleteAll() {
        baseMapper.deleteAll();
    }
    @Override
    public void saveToProducts(String version) {
        baseMapper.updateToProducts(version);
        baseMapper.insertToProducts(version);
    }

    public List<Product> getBySku(List<String> skus) {
        return baseMapper.getProductBySku(skus);
    }
}
